<?php

namespace App\HttpController\Index;

use App\Base\HomeBaseController;
use EasySwoole\Core\Http\Request;
use EasySwoole\Core\Http\Response;
use think\Db;

/**
 * Class Index
 * @package App\HttpController
 */
class Index extends HomeBaseController
{
    public function __construct(string $actionName, Request $request, Response $response)
    {
        parent::__construct($actionName, $request, $response);
    }

    protected function onRequest($action): ?bool
    {
        return parent::onRequest($action); // TODO: Change the autogenerated stub
    }
    
    public function index()
    {
        $sql = "show tables";
        $re = Db::query($sql);
//        var_dump($re);
        $assign = array(
            'test'=>1,
            'db'=>$re
        );
        $this->getView()->assign($assign);
        $this->fetch('index');
    
    }

    public function test(){
        $this->session()->set('user',array('nickname'=>'仙士可123','name'=>'tioncico123'));
    }

}

